import React, { useContext } from "react";
import { ThemeContext } from './useContext'
export default function ThemeButton() {
  // 通过 useContext 获取父组件传来的参数和方法
  const { theme, toggleTheme } = useContext(ThemeContext);

  return (
    <button style={{ background: theme.background, color: theme.foreground }} onClick={toggleTheme}>
      Change the button's theme
    </button>
  );
}